<?php

// uncomment the following to define a path alias
// Yii::setPathOfAlias('local','path/to/local-folder');
Yii::setPathOfAlias('bootstrap', dirname(__FILE__).'/../extensions/bootstrap');

// This is the main Web application configuration. Any writable
// CWebApplication properties can be configured here.
return array(
	'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..',

	// autoloading model and component classes
	'import' => array(
		'application.models.*',
		'application.components.*',
		'application.modules.user.models.*',
		'application.modules.user.components.*',
	),

	'name'=>'FUN TIME',

	// preloading 'log' component
	'preload'=>array('log'),

	// autoloading model and component classes
	'import'=>array(
		'application.models.*',
		'application.components.*',
	),

	'modules' => array(
            // uncomment the following to enable the Gii tool

            'gii' => array(
                'class' => 'system.gii.GiiModule',
                'password' => 'gii',
                // If removed, Gii defaults to localhost only. Edit carefully to taste.
                'ipFilters' => array('127.0.0.1', '::1'),
                'generatorPaths' => array(
                    'bootstrap.gii',
                ),
            ),
            'user' => array(
                'tableUsers' => 'users',
                'tableProfiles' => 'user_profiles',
                'tableProfileFields' => 'user_profiles_fields',
            ),
            'auth' => array(
                'strictMode' => true, // when enabled authorization items cannot be assigned children of the same type.
                'userClass' => 'User', // the name of the user model class.
                'userIdColumn' => 'id', // the name of the user id column.
                'userNameColumn' => 'username', // the name of the user name column.
                'defaultLayout' => 'application.views.layouts.main', // the layout used by the module.
                'viewDir' => null, // the path to view files to use with this module.
            ),
        ),

	// application components
	'components'=>array(

		'authManager' => array(
			'class' => 'auth.components.CachedDbAuthManager',
			'cachingDuration' => 3600,
			'behaviors' => array(
				'auth' => array(
					'class' => 'auth.components.AuthBehavior',
				),
			),
		),
		'user' => array(
			'class' => 'auth.components.AuthWebUser',
			'admins' => array('admin', 'foo', 'bar'), // users with full access

			// enable cookie-based authentication
			'allowAutoLogin' => true,
			'loginUrl' => array('/user/login'),
		),

		// uncomment the following to enable URLs in path-format
		'urlManager'=>array(
			'urlFormat'=>'path',
			'rules'=>array(
				'<controller:\w+>/<id:\d+>'=>'<controller>/view',
				'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
				'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
			),
		),
/*
		'db'=>array(
			'connectionString' => 'sqlite:'.dirname(__FILE__).'/../data/testdrive.db',
		),
 */
		'db'=>array(
			'connectionString' => 'mysql:host=localhost;dbname=sc',
			'emulatePrepare' => true,
			'username' => 'root',
			'password' => 'toptech',
			'charset' => 'utf8',
		),

		'errorHandler'=>array(
			// use 'site/error' action to display errors
			'errorAction'=>'site/error',
		),
		'log'=>array(
			'class'=>'CLogRouter',
			'routes'=>array(
				array(
					'class'=>'CFileLogRoute',
					'levels'=>'error, warning',
				),
				// uncomment the following to show log messages on web pages

//				array(
//					'class'=>'CWebLogRoute',
//				),

			),
		),

		'bootstrap' => array(
			'class' => 'bootstrap.components.Bootstrap',
		),
	),

	// application-level parameters that can be accessed
	// using Yii::app()->params['paramName']
	'params'=>array(
		// this is used in contact page
		'adminEmail'=>'webmaster@example.com',
	),
);